package com.tushare.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tushare.dto.DailyBasicDto;
import com.tushare.entity.DailyBasic;
import com.tushare.mapper.DailyBasicMapper;
import com.tushare.service.IDailyBasicService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author jobob
 * @since 2021-03-08
 */
@Service
public class DailyBasicServiceImpl extends ServiceImpl<DailyBasicMapper, DailyBasic> implements IDailyBasicService {

    @Override
    public boolean saveDailyBasics(List<DailyBasic> list) {
        if (list == null) {
            return false;
        }
        if (list.size() == 0) {
            return true;
        }
        return getBaseMapper().saveOrUpdateBatch(list);
    }

    @Override
    public int getStockBasicCount(String ts_code) {
        return getBaseMapper().getStockBasicCount(ts_code);
    }

    @Override
    public DailyBasic getLastStockBasic() {
        return getBaseMapper().getLastStockBasic();
    }

    @Override
    public DailyBasic getLastStockBasicByTsCode(String ts_code) {
        return getBaseMapper().getLastStockBasicByTsCode(ts_code);
    }

    @Override
    public List<DailyBasic> getStockBasicByTsCode(String ts_code) {
        return getBaseMapper().getStockBasicByTsCode(ts_code);
    }

    @Override
    public List<DailyBasic> getAllDailyBasic() {
        return getBaseMapper().getAllDailyBasic();
    }

    @Override
    public List<DailyBasic> getLastDailyBasics(String ts_code, int count) {
        return getBaseMapper().getLastDailyBasics(ts_code, count);
    }

    @Override
    public List<DailyBasicDto> getDailyBasicDto(String ts_code) {
        return getBaseMapper().getDailyBasicDto(ts_code);
    }

    @Override
    public boolean deleteAllDailyBasic() {
        return getBaseMapper().deleteAllDailyBasic();
    }
}
